<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="author" content="wangbo">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 判断数组是不是有序  
    //要么从小到大,要么从大到小
    // Array.prototype.myforeach = function (fn) {
    //   for (let i = 0; i < this.length; i++) {
    //     const ele = this[i];
    //     fn(ele)
    //   }
    // }
    let arr = [5, 4, 3, 6, 22, 77, 10, 2]

    // arr.myforeach((item) => {
    //   console.log(item);
    // })

    arr.splice(2,2,100)
    console.log(arr);
  </script>
</body>

</html>